package com.cs.controller;

import com.cs.entity.Student;
import com.cs.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@ResponseBody
public class StudentController {
    @Autowired
    private StudentService studentService;
    @RequestMapping("/t1")
    public List<Student> selectAll(){
        return studentService.selectAll();
    }
    @RequestMapping("/t2")
    public Student selectId(int id){
        return studentService.selectId(id);
    }
    @RequestMapping(value = "/t3",produces = "application/json;charset=utf-8")
    public String deleteId(int id){
        return studentService.deleteId(id);
    }
    @RequestMapping(value = "/t4",produces = "application/json;charset=utf-8")
    public String input(@RequestBody Student student){
        return studentService.update(student);
    }
}
